package com.hxit.huaxiamelongarden.controller;

import com.hxit.huaxiamelongarden.domin.dto.ContentDto;
import com.hxit.huaxiamelongarden.service.ContentService;
import com.hxit.huaxiamelongarden.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName SendContentController
 * @description 发帖子--种瓜
 * @Author 12694
 * @Date 2025/1/29 20:04
 * @Version 1.0
 **/
@RestController
@Slf4j
@Tag(name = "发帖子--种瓜", description = "发帖子--种瓜")
@RequestMapping("/sendContent")
public class SendContentController {
    @Autowired
    private ContentService contentService;
    //发帖子
    @Operation(summary = "发送帖子")
    @PostMapping("/send")
    public Result send(@RequestBody ContentDto contentDto, @RequestAttribute("userId") String userId){
        contentDto.setUserId(Integer.parseInt(userId));
        log.info("发送帖子:{}",contentDto);
        contentService.addContent(contentDto);
        return Result.success();
    }
}
